<template>
  <div>
    <van-nav-bar
      title="新建分组"
      left-text="返回"
      right-text="完成"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onSubmit"
    />

      <van-field
        v-model="itemTypeObj.itemTypeName"
        colon
        name="分组名称"
        label="分组名称"
        placeholder="分组名称"
        :rules="[{ required: true, message: '请填写分组名称' }]"
      />
      <van-field
        v-model="detail"
        colon
        name="分组描述"
        label="分组描述"
        placeholder="分组描述"
        :rules="[{ required: true, message: '请填写分组描述' }]"
      />
  </div>
</template>

<script>
import axios from 'axios';


export default {
  name: 'ManagementGroupNewgroup',
  data(){
    return{
      // 商家信息
      shop:this.$store.state.shop,

      itemTypeObj:{
        itemTypeName: '',
        shopId:this.$store.state.shop.shopId
      },
      detail: '',
    };
  },
  methods:{
    onClickLeft() {
      this.$router.push({
      name:'group'
    })
    },
    onSubmit() {
      axios.defaults.headers['Content-type'] = 'application/x-www-form-urlencoded;charset=utf-8';
      axios.post("/api/item/itemType/add",this.itemTypeObj).then( result => {
        console.log(result.data);
      })
    },
  },
  
}
</script>
  
<style scoped>
  
</style>
